package com.cloud.mall.usr.service;


import com.cloud.mall.api.CommonPage;
import com.cloud.mall.base.BaseResponse;
import com.cloud.mall.user.dto.UpdateAdminPasswordParam;
import com.cloud.mall.user.input.UmsAdminInpDTO;
import com.cloud.mall.user.input.UmsMenuInpDTO;
import com.cloud.mall.user.output.UmsAdminOut;
import com.cloud.mall.user.output.UmsMenuOut;
import com.cloud.mall.user.output.UmsPermissionOut;
import com.cloud.mall.user.output.UmsRoleOut;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;


@Api(tags = "会员服务接口")
public interface UmsAdminService {


    /**
     * 根据用户id获取用户
     */
    @ApiOperation(value = "根据用户id获取用户")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query", name = "id", dataType = "Long", required = true, value = "用户ID"), })
    @GetMapping("/getItemById")
    BaseResponse<UmsAdminOut> getItem(@RequestParam("id") Long id);

    @ApiOperation(value = "用户注册")
    @PostMapping("/register")
    BaseResponse<UmsAdminOut> register(@RequestBody @Validated UmsAdminInpDTO umsAdminInpDTO);


    @ApiOperation(value = "根据用户名或昵称分页查询用户")
    @GetMapping("/list")
    BaseResponse  <CommonPage<UmsAdminOut>> list(String keyword, Integer pageSize, Integer pageNum);

    @ApiOperation("修改指定用户信息")
    @PostMapping("/update/{id}")
    BaseResponse update(@PathVariable Long id, @RequestBody UmsAdminInpDTO adminInpDTO);

    @ApiOperation("删除指定用户")
    @PostMapping("/delete/{id}")
    BaseResponse delete(@PathVariable Long id);

    @ApiOperation("给用户分配角色")
    @PostMapping("/role/update")
    BaseResponse updateRole(Long adminId, List<Long> roleIds);

    @ApiOperation(value = "修改指定用户密码")
    @PostMapping("/updatePassword")
    BaseResponse updatePassword(@RequestBody UpdateAdminPasswordParam updatePasswordParam);

    @ApiOperation("修改帐号状态")
    @PostMapping("/updateStatus/{id}")
    BaseResponse updateStatus(@PathVariable Long id,@RequestParam(value = "status") Integer status);

    @ApiOperation("获取指定用户的角色")
    @RequestMapping(value = "/role/{adminId}", method = RequestMethod.GET)
    @ResponseBody
    BaseResponse <List<UmsRoleOut>> getRoleList(@PathVariable Long adminId);

    @ApiOperation("给用户分配+-权限")
    @PostMapping("/permission/update")
    BaseResponse updatePermission(@RequestParam Long adminId,
                                         @RequestParam("permissionIds") List<Long> permissionIds);

    @ApiOperation("获取用户所有权限（包括+-权限）")
    @GetMapping("/permission/{adminId}")
    BaseResponse <List<UmsPermissionOut>> getPermissionList(@PathVariable Long adminId);
}
